package com.mediacatalyst.string {	import flash.text.TextField;	import com.mediacatalyst.math.Range;				public function findHrefs(textfield:TextField,callback:Function=null):Array{		var reg:RegExp = new RegExp("<a href=.[^>]*>.[^>]*<\/a>","ig");		var result:Object = reg.exec(textfield.htmlText);				var b:int = 0;		var e:int = 0;		var r:Array = new Array();		var c:RegExp = new RegExp("<[a-zA-Z\/][^>]*>","ig");				while (result != null) {			b = textfield.htmlText.substr(0,result['index']).replace(c,"").length;			e = textfield.htmlText.substr(0,reg.lastIndex).replace(c,"").length;						if(callback!=null){				try{					callback(b,e,textfield);				}catch (err:Error) { ; }			}						r.push(new Range(b,e));			    		result = reg.exec(textfield.htmlText);		}				return r;	}}